package com.yingli.fragment.base;

import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;



/**
 * Created by jbwl on 2018/10/10 09:55.
 */

public abstract class BaseActivity extends BaseAbsActivity {

//    public <T> ObservableTransformer<T, T> setThread() {
//        return new ObservableTransformer<T, T>() {
//            @Override
//            public ObservableSource<T> apply(Observable<T> upstream) {
//                return upstream.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
//            }
//        };
//    }


    @Override
    public Resources getResources() {
        Resources res = super.getResources();
            Configuration config = new Configuration();
            config.setToDefaults();
        return res;
    }

    @Override
    protected void initCView(Bundle savedInstanceState) {
        setStatusBar();
        initView(savedInstanceState);

    }

    protected void setStatusBar() {
//        StatusBarUtil.immersive(this, getResources().getColor(R.color.colorPrimary));
    }

    @Override
    protected void initCData() {
        initData();
    }

    protected abstract void initView(Bundle savedInstanceState);

    protected abstract void initData();

    @Override
    protected abstract int getContentViewId();

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        //解决fragemnt重叠的问题
        outState.putParcelable("android:support:fragments", null);
    }
}
